#include "DataWalk.h"

#include "UI/ModRun/Output/FactoryOutput.h"

DataWalk::DataWalk()
{
    m_strData = "";
    QString strOutput = "DataWalk 构造:";
    qDebug() << strOutput;
    std::shared_ptr<IOutput> pOutPut = FactoryOutput::GetInstance()->CreateRunOutput();
    if (pOutPut)
    {
        std::initializer_list<QString> outList{ strOutput };
        pOutPut->OutPut(outList);
    }
}

DataWalk::~DataWalk()
{
    QString strOutput = "DataWalk 析构:";
    qDebug() << strOutput;
    std::shared_ptr<IOutput> pOutPut = FactoryOutput::GetInstance()->CreateRunOutput();
    if (pOutPut)
    {
        std::initializer_list<QString> outList{ strOutput };
        pOutPut->OutPut(outList);
    }
}

void DataWalk::SetData(QString strData)
{
    m_strData = strData;
}

void DataWalk::Print()
{
    QString strThis = QString::number(reinterpret_cast<quintptr>(this), 16);
    QString strOutput = "DataWalk Print:" + strThis + " :" + m_strData;
    qDebug() << strOutput;
    std::shared_ptr<IOutput> pOutPut = FactoryOutput::GetInstance()->CreateRunOutput();
    if (pOutPut)
    {
        std::initializer_list<QString> outList{ strOutput };
        pOutPut->OutPut(outList);
    }
}

std::unique_ptr<BaseData> DataWalk::Clone()
{
    std::unique_ptr<DataWalk> ptr = std::make_unique<DataWalk>(*this);
    //进行深拷贝;
    return ptr;
}
